<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        * {
            margin: 0px;
            padding: 0px;
            list-style: none;
        }

        .menu {
            width: 200px;
            height: 30px;
            line-height: 30px;
            text-align: center;
            font-size: 14px;
            margin: 100px;
        }

        .menu li {
            width: 33.33%;
            float: left;
            height: 100%;
            cursor: pointer;
            position: relative;
        }

        .menu1 li:hover,
        .menu1 li.active {
            border-bottom: 3px solid orangered
        }


        .menu li:hover {
            color: orangered;
        }

        .menu2 li:hover .line {
            width: 100%;
        }

        .menu2 .line {
            width: 0%;
            position: absolute;
            right: 0px;
            transition: 0.2s;
            height: 3px;
            background: orangered
        }

        .menu3 li:hover .line {
            width: 100%;
        }

        .menu3 .line {
            width: 0%;
            transition: 0.2s;
            height: 3px;
            background: orangered
        }


        .menu4 li:hover .line {
            transform: scale(1);
        }

        .menu4 .line {
            width: 100%;
            transform: scale(0);
            transition: 0.2s;
            height: 3px;
            background: orangered
        }
    </style>
</head>

<body>
    <ul class="menu menu1">
        <li class="active">手机</li>
        <li>电视</li>
        <li>电脑</li>
    </ul>

    <ul class="menu menu2">
        <li class="active">手机
            <div class="line"></div>
        </li>
        <li>电视 <div class="line"></div>
        </li>
        <li>电脑 <div class="line"></div>
        </li>
    </ul>

    <ul class="menu menu3">
        <li class="active">手机
            <div class="line"></div>
        </li>
        <li>电视 <div class="line"></div>
        </li>
        <li>电脑 <div class="line"></div>
        </li>
    </ul>

    <ul class="menu menu4">
        <li class="active">手机
            <div class="line"></div>
        </li>
        <li>电视 <div class="line"></div>
        </li>
        <li>电脑 <div class="line"></div>
        </li>
    </ul>
</body>

</html>